export default {
  no: {
    type: undefined,
    label: '不限',
    reg: new RegExp(),
  },
  string: {
    type: 'string',
    label: '字符串',
    reg: new RegExp('^[u4E00-u9FA5A-Za-z0-9_]+$'),
  },
  number: {
    type: 'number',
    label: '数字',
    reg: new RegExp('^-?[0-9]*$'),
  },
  id_card: {
    type: 'number',
    label: '身份证号',
    reg: new RegExp('(^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9X]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)'),
  },
  abc: {
    type: 'abc',
    label: '字母',
    reg: new RegExp('^[A-Za-z]+$'),
  },
  zh_cn: {
    type: 'zh_cn',
    label: '中文',
    // eslint-disable-next-line no-control-regex
    reg: new RegExp('[^\x00-\xff]'),
  },
  boolean: {
    type: 'boolean',
    label: '布尔',
  },
  method: {
    type: 'method',
    label: '函数',
  },
  regexp: {
    type: 'regexp',
    label: '正则',
  },
  integer: {
    type: 'integer',
  },
  float: {
    type: 'float',
    label: '浮点',
    reg: new RegExp('^(-?d+)(.d+)?$'),
  },
  array: {
    type: 'array',
    label: '数组',
  },
  object: {
    type: 'object',
    label: '对象',
  },
  enum: {
    type: 'enum',
    label: '枚举',
  },
  mobile: {
    type: 'mobile',
    label: '手机号/固定电话',
    reg: {
      test (val) {
        const isPhone = /^1[3-9]\d{9}$/
        const isLinePhone = /^0\d{2,3}-[1-9]\d{4,7}$/
        return (isLinePhone.test(val) || isPhone.test(val))
      },
    },
  },
  date: {
    type: 'date',
    label: '时间',
    reg: new RegExp('^d{4}-d{1,2}-d{1,2}'),
  },
  url: {
    type: 'url',
    label: '链接',
    reg: new RegExp('[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(/.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+/.?'),
  },
  hex: {
    type: 'hex',
  },
  email: {
    type: 'email',
    label: '邮箱',
    reg: new RegExp('^[A-Za-z0-9\\u4e00-\\u9fa5]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$'),
  },
}
